Skip to content

Add description for using code-server as a systemd unit #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

nwtnsqrd
Copy link
Contributor

Describe in detail the problem you had and how this PR fixes it

I needed this extra piece of information and had to get it from another source. Might be convenient to include it here.

Is there an open issue you can link to?

No.


[Service]
Type=simple
User=<USER>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also set environment file. There is a instance the User environment is not being used by systemd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please suggest changes as I am not aware of the issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
User=<USER>
User=<USER>
EnvironmentFile=$HOME/.profile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, see my systemd Unit file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sr229 The Environment file can't work it has wrong formart systemd expects a other formart it will not execute that file with if else statements.

VAR=VALUE

is the only thing that is accepted in it!

@kylecarbs
Copy link
Member

Ping @nwtnsqrd

sr229 suggested to add "EnvironmentFile" for the systemd unit
@nwtnsqrd
Copy link
Contributor Author

nwtnsqrd commented Apr 18, 2019

I updated the PR


ExecStart=<PATH TO BINARY> --allow-http

StandardOutput=file:/var/log/code-server-output.log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Ubuntu 16.04 the Standard* options were not recognized. I ended up with the following systemd unit (I anyways prefer logging to go to journald):

[Unit]
Description=VSCode in a browser
After=network.target

[Service]
Type=simple
User=myuser
EnvironmentFile=$HOME/.profile
Restart=on-failure
RestartSec=10

ExecStart=/usr/local/bin/code-server --allow-http --port 1234 --no-auth --disable-telemetry $HOME/dev-workspace

ExecStop=/sbin/start-stop-daemon --stop -x /usr/local/bin/code-server

[Install]
WantedBy=multi-user.target

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a more viable alternative is to log this to journald if needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always be logging to journald.

Copy link
Contributor

@sr229 sr229 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is it chief

@nodesocket
Copy link
Contributor

This is a very useful doc PR. Having a peer reviewed systemd config file is 💰.

My only comment is to add --disable-telemetry to ExecStart.

@nhooyr
Copy link
Contributor

nhooyr commented Sep 20, 2019

@sr229 Can you take this over with the one modification to log to journald? Just removing the log file line should fix it. Make sure you include @nwtnsqrd's commit in your PR so we can give him attribution.

@sr229
Copy link
Contributor

sr229 commented Sep 20, 2019

@nhooyr We already have it on quickstart.md, I'll Co-Author them while adding their changes.

@nhooyr
Copy link
Contributor

nhooyr commented Sep 20, 2019

Sounds good.

@nhooyr nhooyr closed this Sep 20, 2019
sr229 added a commit that referenced this pull request Sep 20, 2019
This is the same PR but with some fixes for v2.

Co-Authored-by: nwtnsqrd <[email protected]>
Signed-off-by: Ayane Satomi <[email protected]>
@sr229 sr229 mentioned this pull request Sep 20, 2019
sr229 added a commit that referenced this pull request Sep 20, 2019
This is the same PR but with some fixes for v2.

Co-Authored-by: nwtnsqrd <[email protected]>
Signed-off-by: Ayane Satomi <[email protected]>
code-asher pushed a commit that referenced this pull request Sep 30, 2019
This is the same PR but with some fixes for v2.

Co-Authored-by: nwtnsqrd <[email protected]>
Signed-off-by: Ayane Satomi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants